package br.sceweb.servico;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import br.sceweb.dominio.Convenio;
import br.sceweb.dominio.Empresa;

public class MySQLConvenioDAO implements IConvenioDAO{
	
	private static final String cadastraConvenio = "INSERT INTO convenio "
			+ "(dataInicio, dataTermino, cnpj) VALUES (?,?,?) ";
	private static final String excluiConvenio = "DELETE FROM convenio WHERE "
			+ "cnpj = ? ";
	private static final String consultaConvenio= "SELECT *  FROM convenio WHERE "
			+ "cnpj = ? ";
	private static final String alterarDados = "UPDATE convenio SET dataInicio = ? "
			+ ", dataTermino=? WHERE cnpj = ? ";
	String msg = "";

	@Override
	public List<Convenio> findAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int update(Convenio convenio) {
		return 0;
		// TODO Auto-generated method stub
		
	}

	@Override
	public int exclui(String cnpj) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void remove(Convenio convenio) {
		PreparedStatement stmt;
		int rc = 0;
		try {
			stmt = MySQLDAOFactory.criaConexao().prepareStatement(excluiConvenio);
			stmt.setString(1, convenio.getCnpj());
			rc = stmt.executeUpdate();
			
			stmt.close();
		} catch (SQLException e) {
			msg = e.getMessage();
		}
		
		
	}
	@Override
	public Convenio consulta(Convenio c) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Convenio> consulta(String cnpj) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String cadastra(Convenio c) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String trazCNPJ(String nome) {
		// TODO Auto-generated method stub
		return null;
	}
	
	

}
